package 寒假作业.LeetCode;

import java.util.HashSet;
import java.util.Set;

public class Num258 {
    private int getNext(int n){
        int totalSum = 0;
        while (n > 0){
            int d = n % 10;
            n = n / 10;
            totalSum += d;
        }
        return totalSum;
    }
    public int addDigits(int num) {
        int ret = num;
        while (ret > 10){
            ret = getNext(ret);
        }
        return ret;
    }
}
